var mongoose = require('mongoose')
var Schema = mongoose.Schema;

var codeSchema = new Schema({
    "problem_id":{
        type: Schema.Types.ObjectId, 
        ref:'problems',
        required: true
    },
    "user_id":{
        type: Schema.Types.ObjectId, 
        ref:'users_datas',
        required: true
    },
    "code":{
        type:String,
        default:""
    },
    "modify_time":{
        type: Date,
        default: Date.now
    }
});
// model的一个参数是DB的一个Schema
module.exports = mongoose.model('Code',codeSchema);